__author__ = 'el_even'

#import json

from browsermobproxy import Server, Client
server = Server(r"D:\Distr\CodeAndSDK\BrowserMobProxy\bin\browsermob-proxy")
server.start()
proxy = server.create_proxy()

from selenium import webdriver
profile = webdriver.FirefoxProfile()
driver = webdriver.Firefox(firefox_profile=profile, proxy=proxy.selenium_proxy())

proxy.new_har()
driver.get("http://penton-pisces-dev.thumbtack.lo/newsuject")

print proxy.har # returns a HAR JSON blob


"""
#dumping HAR onto harddrive for debugging, no need of this after code polished
with open(har_name + ".json", 'w') as outfile:
    json.dump(headers, outfile)
"""


server.stop()
driver.quit()
